//
//  UIBarbuttonItem+Extension.swift
//  WHWeiBo
//
//  Created by Li Changjian on 16/7/9.
//  Copyright © 2016年 Li Changjian. All rights reserved.
//

import UIKit

extension UIBarButtonItem {

    convenience init?(title: String, target: AnyObject, action: Selector) {
        
        self.init()
        
        let button = UIButton()
        button.setTitle(title, forState: .Normal)
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        
        customView = button
        
    }

}
